import React from 'react';
import logo from './logo.svg';
import {Button} from 'antd';
import './App.css';
import {renderRoutes} from "react-router-config";
import {BrowserRouter, HashRouter,Link} from "react-router-dom";
import routers from './router'
import Count from '@/redux/count'
import {createStore,applyMiddleware,compose} from 'redux'
import rootReducer from './redux/reducer'
import {Provider}from 'react-redux'
import {createLogger} from 'redux-logger'
import thunk from 'redux-thunk'

import styles from './App.module.less'

const store=createStore(rootReducer,applyMiddleware(
        thunk,createLogger()
    )
);

function App() {
  return (
      <div className="App">
        <Provider store={store}>
          <header className="App-header">
            <img src={logo} className="App-logo" alt="logo"/>
            <p>
              Edit <code>src/App.js</code> and save to reload.
            </p>
            <a
                className="App-link"
                href="https://reactjs.org"
                target="_blank"
                rel="noopener noreferrer"
            >
              <Button type="primary">Learn React</Button>
            </a>
            <div style={{}} className={styles['bg-gray']}>
              <HashRouter>
                <Button.Group>
                  <Button> <Link to='/'>HOME</Link> </Button>
                  <Button> <Link to='/child/1/grand-child'>crand child</Link> </Button>
                  <Button> <Link to='/child/1/grand-child1'>crand child1</Link> </Button>
                  <Button> <Link to='/child/1/grand-child2'>crand child2</Link> </Button>
                  <Button> <Link to='/child/1/RouterTestHook'>crandhook</Link> </Button>
                  <Button> <Link to='/child/counthook'>hook</Link> </Button>
                  <Button> <Link to='/child/1'>child</Link> </Button>
                </Button.Group>
                {renderRoutes(routers)}
              </HashRouter>
            </div>
          </header>
          <Count/>
        </Provider>

      </div>
  );
}

export default App;
